/**
 * 
 */
package com.mc.metaSearch;

import java.util.Map;

/**
 * Class Name: google_thread
 * @Author zhenjiang liu
 * @Date 2010-12-25
 * @Time 下午03:54:25
 */
public class google_thread extends Thread{ 
	String querystring;
	Map<Integer, String> gurls ;
	Map<Integer, String> gabstracts ;
	Map<Integer, String> gtitles ;
	Map<Integer, String> gsubtitles ;
	String[] r;
	/**
	 * @param querystring2
	 */
	public google_thread(String querystring) {
		this.querystring=querystring;
	}
	public String[]getR()
	{
		try{
			this.join();
			return r;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}
	public Map<Integer, String> getulr()
	{
		try
		{
			this.join();
			return gurls;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}
	public Map<Integer, String>getabstracts()
	{
		try{
			this.join();
			return gabstracts;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}
	public Map<Integer, String>gettitle()
	{
		try{
			this.join();
			return gtitles;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}	
	public Map<Integer, String>getsubtitle()
	{
		try{
			this.join();
			return gsubtitles;
		}
		catch (InterruptedException e) {            
            e.printStackTrace();
            return null;
        }   
		
	}	
	public void run()
	{
			GoogleSearch	b = new GoogleSearch();
		try {
			Thread.sleep(20);
			r = b.getContent(this.querystring);
			gurls = b.getURL(r);
			gabstracts = b.getAbstract(r);
			gtitles = b.getTitle(r);
			gsubtitles = b.gsubtitles;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
